package com.example.thymeleaf2.controller;

import com.example.thymeleaf2.domain.Article;
import com.example.thymeleaf2.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import javax.sql.DataSource;
import java.util.*;


@Controller
public class ArticleController{
@Autowired
ArticleService articleService;
@GetMapping("/article")
public String article(Model model){
        List<Article> articleList = articleService.findAll();
        model.addAttribute("articles", articleList);
        return "article";
        }
        }

